package com.cy.action;

import java.util.ArrayList;
import java.util.List;

import net.sf.json.JSONException;




import com.cy.bean.User;
import com.cy.service.UserService;
import com.cy.tool.FilterParam;
import com.opensymphony.xwork2.ActionSupport;
 

public class Login extends ActionSupport {
	//Serial Version UID
	private static final long serialVersionUID = -8381819119964840656L;

	
	private UserService userService;
	private User user;
	

	public String login()
	{
		if(user==null){
			return ERROR;
		}
		else
		{
			boolean checked = userService.checkAuthority(user.getName(),user.getPaw());
			if(checked)
			{
				return SUCCESS;
			}
			else
			{
				return ERROR;
			}
		}
		
	}

	public String pageQuery(){
		List<FilterParam> profilters = new ArrayList<FilterParam>();
		profilters.add(new FilterParam("exist", 1, FilterParam.kind.EQ));
		profilters.add(new FilterParam("projectlevel", 1, FilterParam.kind.EQ));
		
	 	
		try{
		 return SUCCESS;
		}catch(Exception e){
			e.printStackTrace();
			return ERROR;
		}
	}
	
	
	
	
	
	 
	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
}